package com.itheima.zuoye.zuoye2;

import java.util.Collections;

public class Test {
    public static void main(String[] args) throws InterruptedException {
        Money m = new Money();
        Thread thread = new Thread(m, "抽奖箱1");
        thread.start();

        Thread thread1 = new Thread(m, "抽奖箱2");
        thread1.start();

        thread.join();
        thread1.join();

       // System.out.println(m.sum1);
      //  System.out.println(m.sum2);
      //  System.out.println(Collections.max(m.sum1));
      //  System.out.println(Collections.max(m.sum2));
        int sum = 0;
        for (int i = 0; i < m.sum1.size(); i++) {
            sum+=m.sum1.get(i);
        }
        System.out.println(thread.getName()+"奖金分别是："+m.sum1+"和是："+sum+","+"最大值是："+Collections.max(m.sum1));
        int sum2=0;
        for (int i = 0; i < m.sum2.size(); i++) {
            sum2+=m.sum2.get(i);
        }
        System.out.println(thread1.getName()+"奖金分别是："+m.sum2+"和是："+sum2+","+"最大值是："+Collections.max(m.sum2));
    }
}
